import { apiResponse, axiosInstance } from 'src/lib/api';

export interface PageView {
  time: string
  uri: string
  count: number
}

export class PageViewAPI {
  public static list(): Promise<PageView[]> {
    return new Promise<PageView[]>((resolve, reject) => {
      axiosInstance({
        method: 'GET',
        url: 'api/statistic/page-view/list'
      }).then(value => {
        const data: apiResponse = value.data as apiResponse
        resolve(data.data as PageView[])
      }).catch(reject)
    })
  }
}
